package com.senven.books.modules.booksManager.controller;

import com.senven.books.modules.system.log.util.SessionUtil;
import com.senven.books.modules.system.user.entity.SysUser;
import com.senven.books.modules.system.user.mapper.SysUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @author : longshengyi
 * @description :
 * @createDate : 2024/7/20 19:46
 */
@RestController
public class HellowController {

    @Autowired
    private SysUserMapper sysUserMapper;

    @PreAuthorize("hasAuthority('ROLE_SUPER_ADMIN')")
    @RequestMapping("/hello")
    public String hello(String msg,String hh) {
        Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
        System.out.println("aut:"+authentication);

        SessionUtil.getUserInfo();
        //查询所有用户
        List<SysUser> sysUsers = sysUserMapper.selectList(null);
        System.out.println(sysUsers);
        return "msg + hh";

    }

}
